package org.seedframework.sharding.resource;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class DoubleWriteDataSourcePoolContext {

    private static Map<String, Set<ShardingDataSource>> dataSourceMap = new HashMap<>();


    public static Set<ShardingDataSource> getDataSourceSet(String group) {
        return dataSourceMap.get(group);
    }

    public static void setDataSourceMap(String group, ShardingDataSource dataSource) {
        Set<ShardingDataSource> set = dataSourceMap.get(group);
        if (set == null) {
            set = new HashSet<>();
        }
        set.add(dataSource);
        dataSourceMap.put(group, set);
    }
}
